# Maintainer: Anatol Pomozov

pkgname=aws-c-cal
pkgver=0.6.1
pkgrel=1
pkgdesc='AWS Crypto Abstraction Layer: Cross-Platform, C99 wrapper for cryptography primitives'
arch=(loong64 x86_64)
url='https://github.com/awslabs/aws-c-cal'
license=(Apache)
depends=(aws-c-common openssl)
makedepends=(cmake)
source=(aws-c-cal-$pkgver.zip::https://github.com/awslabs/aws-c-cal/archive/v$pkgver.zip)
sha256sums=('38110cd6b5beb3e99e55a3d55593565ebc8f2b15d190afa4d76f4265d45daf9e')

build() {
  cd aws-c-cal-$pkgver

  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -S . -B build
  cmake --build build
}

check() {
  cd aws-c-cal-$pkgver
  cmake --build build --target test
}

package() {
  cd aws-c-cal-$pkgver

  cmake --build build --target install -- DESTDIR="$pkgdir/"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
